﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Register : DLL.MyWebPage
{
	private DLL.User.Component clsUserComp;

	protected void Page_Load(object sender, EventArgs e)
	{
		if (!IsPostBack)
		{
			clsControl.ShowAllDepartment(DdlDepartment);
		}
	}

	protected override void OnInit(EventArgs e)
	{
		clsUserComp = new DLL.User.Component(Page);

		base.OnInit(e);

		BtnRegister.Click += new EventHandler(BtnRegister_Click);
	}

	void BtnRegister_Click(object sender, EventArgs e)
	{
		DLL.User.Entity clsAddUser = new DLL.User.Entity();

		clsAddUser.Username = TbUsername.Text;
		clsAddUser.Password = TbPassword.Text;
		clsAddUser.JobNumber = TbJobNumber.Text;
		clsAddUser.PersonName = TbName.Text;
		clsAddUser.IDCard = TbIDCard.Text;
		clsAddUser.DepartmentID = Convert.ToInt32(DdlDepartment.Text);
		clsAddUser.UserGroupID = 5;

		if (clsUserComp.Add(clsAddUser))
		{
			TonyNet4V1.ShowMessageAlert.ShowMessage(Page, "注册成功！");
		}
	}
}